
class MyStack {
  queue<int> qu;
public:
  MyStack() {
      
  }
  
  void push(int x) {
      qu.push(x);
  }
  
  int pop() {
      int n = qu.size();
      int temp = 0;
      while(n--){
          temp = qu.front();
          if(n != 0) qu.push(temp);
          qu.pop();
      }
      return temp;
  }
  
  int top() {
      int n = qu.size();
      int temp = 0;
      while(n--){
          temp = qu.front();
          qu.push(temp);
          qu.pop();
      }
      return temp;
  }
  
  bool empty() {
      return qu.empty();
  }
};

/**
* Your MyStack object will be instantiated and called as such:
* MyStack* obj = new MyStack();
* obj->push(x);
* int param_2 = obj->pop();
* int param_3 = obj->top();
* bool param_4 = obj->empty();
*/